package nl.ajonker.railroad.bl;

import nl.ajonker.railroad.dl.SwitchRail;
import nl.ajonker.railroad.sl.SwitchAddress;

public class SwitchCommand {
    public static String getCommand(SwitchAddress address, SwitchRail.SwitchState switchState) {
        StringBuilder result = new StringBuilder();
        result.append('!').append(address.getPrint()).append('t');
        result.append(address.getNumber());
        if (switchState == SwitchRail.SwitchState.STRAIGHT)
            result.append('s');
        else
            result.append('b');

        return result.toString();
    }
}
